<script setup lang="ts">
import { onMounted, ref } from 'vue'
import {getStat} from '../../../api/index'
const warehouseNum = ref<number>(0);
const inventoryNum = ref<number>(0);
const returnNum = ref<number>(1);
const reqNUm = ref<number>(0);
onMounted(()=>{
  getStat().then(res=>{
    warehouseNum.value = res.data.warehouseNum;
    inventoryNum.value = res.data.inventoryNum;
    returnNum.value = res.data.recoverNum;
    reqNUm.value = res.data.receiveNum+res.data.unReceiveNum;
  })
})

</script>

<template>
  <div class="toptitlemain centered-gradient">
    <div class="item">
        <span>{{ warehouseNum||0 }}</span>
        <span class="text">入库总数</span>
      </div>
      <div class="item">
        <span>{{ inventoryNum||0 }}</span>
        <span class="text">库存数</span>
      </div>
      <div class="item">
        <span>{{ reqNUm||0 }}</span>
        <span class="text">请领总数</span>
      </div>
      <div class="item">
        <span>{{ returnNum||0 }}</span>
        <span class="text">回收总数</span>
      </div>
  </div>
</template>

<style scoped lang="less">
.read-the-docs {
  color: #888;
}

.toptitlemain{
  width: 100%;
  height: 15vh;
  display: flex;
  border: 1px solid rgb(92, 98, 107);
  border-radius: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 0 1vw;
  box-sizing:border-box;
  color: rgb(192, 215, 255);
  .item{
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    height: 50%;
    & :first-child {
      font-size: 20px;
      font-weight: bold;
    }
    .text{
      font-size: 16px;
    }
  }
}
</style>
